package com.ecds.monitor.http;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
//HTTP连接与浏览
public class GetHttpHtmlThread extends Thread {
	public String html;
	private String urlStr;

	public GetHttpHtmlThread(String urlStr) {
		this.urlStr = urlStr;
	}

	public void run() {
		try {
			URL address = new URL(urlStr); // 得到HTML页面的URL地址

			BufferedReader in = new BufferedReader(new InputStreamReader(
					address.openStream())); // 获取输入流
			String line;
			StringBuffer content = new StringBuffer(); // 文件内容
			while ((line = in.readLine()) != null) { // 读取文件
				content.append(line + "\n");
			}
			html = new String(content);
			in.close(); // 关闭输入流
		} catch (Exception ex) {
			ex.printStackTrace(); // 输出出错信息
		}
	}

}